-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for userspace MSR handling #241
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00xc
requested review from
acatangiu,
alxiord,
andreeaflorescu,
lauralt,
sameo,
roypat and
JonathanWoollett-Light
as code owners
November 15, 2023 11:08
roypat
previously approved these changes
Nov 15, 2023
Reordered |
roypat
previously approved these changes
Nov 16, 2023
Rebased on main, fixed conflicts and updated coverage. |
roypat
previously approved these changes
Nov 17, 2023
Add the appropriate types to allow for a VMM to intercept RDMSR and WRMSR instructions if access to an MSR is denied. By default, KVM injects #GP on denied accesses. To do this we need to add a new Cap variant which corresponds to KVM_CAP_X86_USER_SPACE_MSR, and two new VcpuExit variants that correspond to KVM_EXIT_X86_RDMSR and KVM_EXIT_X86_WRMSR respectively. We also need helper types to pass the relevant information about the exit to the VMM. Signed-off-by: Carlos López <[email protected]>
Add two tests to verify respectively that reading and writing to an invalid MSR trigger a VcpuExit. Signed-off-by: Carlos López <[email protected]>
Signed-off-by: Carlos López <[email protected]>
Rebased on main and fixed conflicts. |
roypat
approved these changes
Nov 21, 2023
Gentle ping for reviewers |
JonathanWoollett-Light
approved these changes
Nov 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the PR
Add support for userspace MSR handling. This is done by enabling the
KVM_CAP_X86_USER_SPACE_MSR
capability, which enables two new exits,KVM_EXIT_X86_RDMSR
andKVM_EXIT_X86_WRMSR
. This allows a VMM to intercept reads and writes to invalid MSRs instead of having KVM automatically inject a#GP
into the guest.This PR adds safe wrappers around
KVM_CAP_X86_USER_SPACE_MSR
,KVM_EXIT_X86_RDMSR
andKVM_EXIT_X86_WRMSR
, some helper types and 2 relevant tests.Requirements
git commit -s
), and the commitmessage has max 60 characters for the summary and max 75 characters for each
description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.